A julia fractal object is a 3-D slice of a 4-D object created by generalizing the process used to create the classic Julia sets. You can make a wide variety of strange objects using julia_fractal, including some that look like bizarre blobs of twisted taffy.
The julia_fractal syntax (with default values listed in comments) is:
The 4-D vector 4DJULIA_PARAMETER is the classic Julia parameter p in the iterated formula f(h) + p.
The julia_fractal object is calculated by using an algorithm that determines whether an arbitrary point h(0) in 4-D space is inside or outside the object. The algorithm requires generating the sequence of vectors h(0), h(1), ... by iterating the formula
h(n+1) = f(h(n)) + p (n = 0, 1, ..., max_iteration-1)
where p is the fixed 4-D vector parameter of julia_fractal, and f() is one of the functions sqr, cube, ... specified by the presence of the corresponding keyword. The point h(0) that begins the sequence is considered inside the julia_fractal object if none of the vectors in the sequence escapes a hypersphere of radius 4 about the origin before the iteration number reaches the max_iteration value. As you increase the max_iteration, some points escape that did not previously escape, making the julia_fractal. Depending on the JULIA_PARAMETER, the julia_fractal object is not necessarily connected; it may be scattered fractal "dust". Using a low max_iteration can fuse together the dust to make a solid object. A high max_iteration is more accurate but slows rendering. Even though it is not accurate, the solid shapes you get with a low_maximum iteration value can be quite interesting.
Since the mathematical object described by this algorithm is four-dimensional, and POV-Ray renders three dimensional objects, there must be a way to reduce the number of dimensions of the object from four dimensions to three. This is accomplished by intersecting the 4-D fractal with a 3-D "plane" defined by the slice filed and then projecting the intersection to 3-D space. The slice plane is the 3-D space that is perpendicular to NORMAL4D and is DISTANCE units from the origin. Zero length NORMAL4D vectors, or a NORMAL4D vector with a zero fourth component are illegal.
The precision parameter is a tolerance used in the determination of whether points are inside or outside the fractal object. Larger values give more accurate results but slower rendering. Use as low a value as you can without visibly degrading the fractal object's appearance.
The presence of the keywords quaternion or hypercomplex determine which 4-D algebra is used to calculate the fractal. Both are 4-D generalizations of the complex numbers but neither satisfies all the field properties (all the properties of real and complex numbers that many of us slept through in high school.) Quaternions have non-commutative multiplication, and hypercomplex numbers can fail to have a multiplicative inverse for some non-zero elements. (It has been proved that you cannot successfully generalize complex numbers to four dimensions with all the field properties intact, so something has to break.) Both of these algebras were discovered in the 19th century. Of the two, the quaternions are much better known, but one can argue that hypercomplex numbers are more useful for our purposes, since complex valued functions such as sin, cos, etc. can be generalized to work for hypercomplex numbers in a uniform way.
Quaternion basis vector multiplication rules:
ij = k; jk = i; ki = j ji = -k; kj = -i; ik = -j ii = jj = kk = -1; ijk = -1;
Hypercomplex basis vector multiplication rules:
ij = k; jk = -i; ki = -j ji = k; kj = -i; ik = -j ii = jj = kk = -1; ijk = 1;
A distance estimation calculation is used with the quaternion calculations to speed them up. The proof that this distance estimation formula works does not generalize from two to four dimensions, but the formula seems to work well anyway, the absence of proof notwithstanding!
The presence of one of the function keywords sqr, cube, etc. determine which function is used for f(h) in the iteration formula h(n+1) = f(h(n)) + p. Most of the function keywords work only if the hypercomplex keyword is present; only sqr and cube work with quaternions. The functions are all familiar complex functions generalized to four dimensions.
Function Keyword Maps 4-D value h to: ================================================ sqr h*h cube h*h*h exp e raised to the power h reciprocal 1/h sin sine of h asin arcsine of h sinh hyperbolic sine of h asinh inverse hyperbolic sine of h cos cosine of h acos arccosine of h cosh hyperbolic cos of h acosh inverse hyperbolic cosine of h tan tangent of h atan arctangent of h tanh hyperbolic tangent of h atanh inverse hyperbolic tangent of h log natural logarithm of h pwr(x,y) h raised to the complex power x+iy
The first renderings of julia fractals using quaternions were done by Alan Norton and later by John Hart in the '80's. This new POV-Ray implementation follows Fractint in pushing beyond what is known in the literature by using hypercomplex numbers and by generalizing the iterating formula to use a variety of transcendental functions instead of just the classic Mandelbrot "z^2 + c" formula. With an extra two dimensions and eighteen functions to work with, intrepid explorers should be able to locate some new fractal beasties in hyperspace, so have at it!
The parameter NUMBER_OF_POINTS determines how many two-dimensional points are forming the curve. These points are connected by linear, quadratic or cubic splines as specified by an optional keyword (the default is linear_spline). Since the curve is not automatically closed, i.e. the first and last points are not automatically connected, you'll have to do this by your own if you want a closed curve. The curve thus defined is rotated about the y-axis to form the lathe object which is centered at the origin.
The cylinder has an inner radius of 2 and an outer radius of 3, giving a wall width of 1. It's height is 5 and it's located at the origin pointing up, i.e. the rotation axis is the y-axis. Note that the first and last point are equal to get a closed curve.
Lathe objects respond to automatic bounding and can be translated, rotated and scaled.
The parameter NUMBER_OF_POINTS determines how many two-dimensional points are forming the curve. These points, which are given in the x-z-plane, are connected by linear, quadratic or cubic splines as specified by an optional keyword (the default is linear spline) to get a closed curve. It is swept along the y-axis from HEIGHT1 to HEIGHT2 to form the prism object. By default linear sweeping is used to create the prism, i.e. the prism's walls are perpendicular to the x-z-plane (the size of the curve doesn't change during the sweep). You can also use conic sweeping that leads to a prism with "cone-like" walls by scaling the curve down during the sweep.
The following example creates a simple prism object that looks like a piece of cake:
For an explanation of the spline concept read the description of the lathe object.
Prism objects respond to automatic bounding and can be translated, rotated and scaled.
Where <CENTER> is a vector specifying the x, y, z coordinates of the center of the sphere and RADIUS is a float value specifying the radius. Spheres may be scaled unevenly giving an ellipsoid shape.
The values of e and n, called the east-west and north-south exponent, determine the shape of the superquadric ellipsoid. Both have to be greater than zero. The sphere is e.g. given by e = 1 and n = 1.
The syntax of the superquadric ellipsoid is:
The object is located at the origin and can be translated, rotated and scaled just like any other object. Since it is finite it responds to automatic bounding.
Two useful objects are the rounded box and the rounded cylinder. These are declared in the following way.
The roundedness r determines the roundedness of the edges and has to be greater than zero and smaller than one. The smaller you choose the values of r the smaller and sharper the edges will get.
Very small values of e and n might cause problems with the root solver.
The syntax of the SOR object is:
The points <POINT1> through <POINTn> are two dimensional vectors consisting of the radius and the corresponding position on the rotation axis. These points are smoothly connected and rotated about the y-axis to form the SOR object. The first and last points are only used to determine the slopes of the function at the start and end point. The function used for the SOR object is similar to the splines used for the lathe object. The difference is that the SOR object is less flexible because it underlies the restrictions of any mathematical function, i.e. to any given point y on the rotation axis corresponds at most one radius. You can't rotate closed curves with the SOR object.
The optional keyword "open" allows you to remove the caps on the SOR object. If you do this you shouldn't use it with CSG anymore because the results may get wrong.
The SOR object is useful for creating bottles, vases, and things like that. A simple vase could look like this:
One might ask why there is any need for a SOR object if there is already a lathe object which is much more flexible. The reason is quite simple. The intersection test with a SOR object includes to solve a cubic polynomial while the test with a lathe object means to solve a 6th order polynomial (you need a cubic spline for the same "smoothness"). Since most SOR and lathe objects will have several segments this will make a great difference in speed. The roots of the 3rd order polynomial will also be more accurate and easier to find.
Surface of revolution objects respond to automatic bounding and can be translated, rotated and scaled.